//
//  HNSH_FeedbackFooterView.m
//  HNSH_SingleProject
//
//  Created by 李宇廷 on 2023/3/7.
//

#import "HNSH_FeedbackFooterView.h"

@interface HNSH_FeedbackFooterView ()
@property (nonatomic, strong)UIButton * sureBtn;
@end

@implementation HNSH_FeedbackFooterView

#pragma mark - Cycle Methods
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self addAllViews];
        [self addAllLayout];
    }
    return self;
}

- (void)addAllLayout{
    [self.sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(0);
        make.height.mas_equalTo(50);
        make.left.mas_equalTo(16);
        make.right.mas_equalTo(-16);
    }];
}

#pragma mark - Myself Methods
- (void)addAllViews{
    [self addSubview:self.sureBtn];
}

- (void)sureBtnAction{
    if (self.commitFeedbackBlock) {
        self.commitFeedbackBlock();
    }
}

#pragma mark - Lazy Methods
- (UIButton *)sureBtn{
    if (!_sureBtn) {
        _sureBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_sureBtn setTitle:@"提交" forState:UIControlStateNormal];
        [_sureBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _sureBtn.titleLabel.font = [UIFont systemFontOfSize:17];
        _sureBtn.backgroundColor = [UIColor appGreenColor];
        _sureBtn.layer.cornerRadius = 25;
        _sureBtn.layer.masksToBounds = YES;
        [_sureBtn addTarget:self action:@selector(sureBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _sureBtn;
}

@end
